package com.ruoyi.common.enums.business;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum KocTaskEnum {

    /**
     * 避坑 id一定不要变 id 变了要手动改回来
     */
    WXSPH(1L, "1", 1L, "1", "微信视频号", "微信视频号"),

    XHS(2L, "2", 1L, "1", "小红书", "小红书"),

    GZH(3L, "3", 1L, "1", "公众号", "公众号"),

    WB(4L, "4", 1L, "1", "微博", "微博"),

    TRLX(5L, "5", 2L, "2", "推人拉新", "推人拉新"),

    BDBJ(6L, "6", 3L, "3", "百度百家号", "百度百家号"),

    TBGG(7L, "7", 4L, "4", "淘宝逛逛发布", "淘宝逛逛发布"),

    MLXG(8L, "8", 5L, "5", "美丽修行发布", "美丽修行发布"),

    YZSCT(9L, "9", 6L, "6", "优质素材图", "优质素材图"),

    BBSCT(10L, "10", 7L, "7", "宝宝皮肤问题素材图", "宝宝皮肤问题素材图"),

    WBQFY(11L, "11", 8L, "8", "非悦哺自营群发言", "非悦哺自营群发言"),

    NBQFY(12L, "12", 9L, "9", "悦哺自营群活跃与维护", "悦哺自营群活跃与维护"),

    SRT_BLT(13L, "13", 10L, "10", "素人贴与避雷贴", "素人贴与避雷贴"),

    GH_XG_BJ(15L, "15", 10L, "10", "产品干货笔记与效果对比笔记", "产品干货笔记与效果对比笔记"),

    SWRC(17L, "17", 10L, "10", "小红书晒娃日常", "小红书晒娃日常"),

    YQWH(18L, "18", 10L, "10", "小红书舆情维护", "小红书舆情维护"),


    ;

    private final Long kocTaskId;

    private final String code;

    private final Long kocTaskTypeId;

    private final String kocTaskTypeCode;

    private final String name;

    private final String desc;


    private static final Map<Long, KocTaskEnum> ENUM_MAP;

    static {
        KocTaskEnum[] values = values();
        Map<Long, KocTaskEnum> enToCn = new HashMap<>(values.length);
        for (KocTaskEnum value : values) {
            enToCn.put(value.kocTaskTypeId, value);
        }
        ENUM_MAP = Collections.unmodifiableMap(enToCn);
    }

    /**
     * 根据类型查找枚举
     */
    public static KocTaskEnum getEnumByType(Long kocTaskTypeId) {
        KocTaskEnum kocTaskTypeEnum = ENUM_MAP.get(kocTaskTypeId);
        if (ObjectUtil.isEmpty(kocTaskTypeEnum)) {
            throw new RuntimeException("");
        }
        return kocTaskTypeEnum;
    }


}
